package com.zjp.service.impl;
import com.zjp.mapper.InoculationHistoryMapper;
import com.zjp.mapper.ReservationMapper;
import com.zjp.pojo.InoculationHistory;
import com.zjp.pojo.Reservation;
import com.zjp.service.ReservationService;
import com.zjp.vo.ISiteAndVaccVo;
import com.zjp.vo.ReservationVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReservationServiceImpl implements ReservationService {
    @Autowired
    private ReservationMapper reservationMapper;
    @Autowired
    private InoculationHistoryMapper historyMapper;

    /**
     * 添加查找所有预约记录
     *
     * @param
     * @return
     */
    public List<ReservationVo> findAllReservationHist() {
//        ReservationExample example=new ReservationExample();
//        ReservationExample.Criteria criteria=example.createCriteria();
//        int id2=(int)id;
//        criteria.andUseridEqualTo(id2);
        return reservationMapper.findAllReservationHist();
    }

    /**
     * 添加接种记录
     *
     * @param inoculationHistory
     * @return
     */
    public int addInoculationHistory(InoculationHistory inoculationHistory) {
        return historyMapper.insert(inoculationHistory);
    }

    /**
     * 更新预约接种状态
     * @param id
     */
    public void updateStuts(Reservation id) {
        reservationMapper.updateStuts(id);
    }

    /**
     * 更新取消预约状态
     * @param id
     * @return
     */
    public int updateCancelStuts(int id) {
        return reservationMapper.updateCancelStuts(id);
    }


//    /**
//     * 添加预约记录
//     * @param reservationVo
//     * @return
//     */
//    public int addreservation(Reservation reservationVo) {
//        return reservationMapper.addReservation(reservationVo);
//    }

    /**
     * 确定预约
     * @param reservation
     * @return
     */
    public int insert(Reservation reservation) {
        return reservationMapper.insert1(reservation);
    }

    /**
     * 查询导航栏
     *
     * @param
     * @return
     */
    public List<ISiteAndVaccVo> findById(ISiteAndVaccVo iSiteAndVaccVo) {
        return reservationMapper.findById(iSiteAndVaccVo);


    }

    /**
     * 更新预约接种状态
     *
     * @param reservation
     * @return
     */
    public int updateStuts1(Reservation reservation) {
        return reservationMapper.updateStuts1(reservation);

    }
}


